package com.demo.controller;


import com.demo.dto.Result;
import com.demo.dto.UserDTO;
import com.demo.entity.Answer;
import com.demo.service.AnswerService;
import com.demo.service.UserFollowService;
import com.demo.vo.AnswerVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@Api(tags = "用户额外信息（用户回答、收藏、关注等）")
@RestController
@RequestMapping("/userExtra/")
public class UserExtraDataController {
    @Resource
    AnswerService answerService;

    @Resource
    UserFollowService userFollowService;

    @ApiOperation("当前登录用户所有回答")
    @GetMapping("answers")
    Result<List<AnswerVO>> answerList() {
        return answerService.getAnswerListByCurrentUserId();
    }

    @ApiOperation("当前登录用户关注列表")
    @GetMapping("followingList")
    Result<List<UserDTO>> followingList() {
        return userFollowService.getFollowingListByCurrentUserId();
    }
}
